﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;

namespace DevExpress.MailClient.Win.Forms
{
    public partial class frmPhysicalFileViewer : PRO_DOCS.BLL.WIN.Templates.DevxPermissionTemplate
    {
        public frmPhysicalFileViewer(
            string file_display_name,
            string file_physical_name,
            List<string> fileSavingFolders
            )
        {
            InitializeComponent();

            this.Text = string.Format("Display {0}..", file_display_name);

            string fullFilePhysicalPath = string.Empty;
            for (int i = 0; i < fileSavingFolders.Count; i++)
            {
                FileInfo fiFileName = new FileInfo(Path.Combine(fileSavingFolders[i], file_physical_name));
                if (fiFileName.Exists)
                {
                    fullFilePhysicalPath = fiFileName.FullName;
                    break;
                }
            }

            if (!string.IsNullOrEmpty(fullFilePhysicalPath))
            {
                ucFilePhysicalViewer1.SHOW_FILE_DISPLAY(new FileInfo(file_display_name).Extension, fullFilePhysicalPath);
            }

        }
    }
}